/**
 * @projectName: project02bywdmtz
 * @package: com.cskaoyan.controller
 * @className: WxTopicController
 * @author: 冉夏
 * @description: TODO
 * @date: 2022/12/31 18:12
 * @version: 1.8
 */

package com.cskaoyan.controller;

import com.cskaoyan.bean.MarketTopic;
import com.cskaoyan.bean.bo.WxTopicDetailBo;
import com.cskaoyan.bean.common.BasePageInfo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.bean.vo.WxTopicVo;
import com.cskaoyan.service.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("wx/topic")
public class WxTopicController {
    /*把所有的主题信息显示
    *
    * */

    @Autowired
    WxTopicService wxTopicService;
    @RequestMapping("list")
    public BaseRespVo getTopicInfo(BasePageInfo basePageInfo) {
        System.out.println(basePageInfo);
        CommonData<WxTopicVo> commonData =wxTopicService.getAllTopInfo(basePageInfo);
        return BaseRespVo.ok(commonData);
    }
    /*
    * 点击主题后回显的详细信息
    * */
    @GetMapping("detail")
    public BaseRespVo getTopicDetail(Integer id){
       WxTopicDetailBo detailBo =wxTopicService.getTopicDetailInfo(id);
        System.out.println(detailBo);
       return BaseRespVo.ok(detailBo);
    }
    /*
    * 获得当前商品的相关主题推荐
    * */
    @GetMapping("related")
    public BaseRespVo getRelatedTopic(Integer id){
        CommonData<MarketTopic> commonData=wxTopicService.getRelatedTopic(id);
        return BaseRespVo.ok(commonData);
    }

}
